﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Example {
  public partial class WebForm2_2 : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }

    protected void Button_Command(object sender, CommandEventArgs e) {
      //Color类需要导入System.Drawing的命名空间
      Color color = Color.White;
      switch (e.CommandName) {
        case "red": color = Color.Red; break;   
        case "green": color = Color.Green; break;
        case "blue": color = Color.Blue; break;
      }
      lblAsp.ForeColor = color;   //设置字体颜色
    }
  }
}